package com.zmhc.product.service.impl;

import java.util.List;
import com.zmhc.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zmhc.product.mapper.CategoryBrandMapper;
import com.zmhc.product.domain.CategoryBrand;
import com.zmhc.product.service.ICategoryBrandService;

/**
 * 商品分类品牌关联Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-12-11
 */
@Service
public class CategoryBrandServiceImpl implements ICategoryBrandService 
{
    @Autowired
    private CategoryBrandMapper categoryBrandMapper;

    /**
     * 查询商品分类品牌关联
     * 
     * @param id 商品分类品牌关联主键
     * @return 商品分类品牌关联
     */
    @Override
    public CategoryBrand selectCategoryBrandById(Long id)
    {
        return categoryBrandMapper.selectCategoryBrandById(id);
    }

    /**
     * 查询商品分类品牌关联列表
     * 
     * @param categoryBrand 商品分类品牌关联
     * @return 商品分类品牌关联
     */
    @Override
    public List<CategoryBrand> selectCategoryBrandList(CategoryBrand categoryBrand)
    {
        return categoryBrandMapper.selectCategoryBrandList(categoryBrand);
    }

    /**
     * 新增商品分类品牌关联
     * 
     * @param categoryBrand 商品分类品牌关联
     * @return 结果
     */
    @Override
    public int insertCategoryBrand(CategoryBrand categoryBrand)
    {
        categoryBrand.setCreateTime(DateUtils.getNowDate());
        return categoryBrandMapper.insertCategoryBrand(categoryBrand);
    }

    /**
     * 修改商品分类品牌关联
     * 
     * @param categoryBrand 商品分类品牌关联
     * @return 结果
     */
    @Override
    public int updateCategoryBrand(CategoryBrand categoryBrand)
    {
        categoryBrand.setUpdateTime(DateUtils.getNowDate());
        return categoryBrandMapper.updateCategoryBrand(categoryBrand);
    }

    /**
     * 批量删除商品分类品牌关联
     * 
     * @param ids 需要删除的商品分类品牌关联主键
     * @return 结果
     */
    @Override
    public int deleteCategoryBrandByIds(Long[] ids)
    {
        return categoryBrandMapper.deleteCategoryBrandByIds(ids);
    }

    /**
     * 删除商品分类品牌关联信息
     * 
     * @param id 商品分类品牌关联主键
     * @return 结果
     */
    @Override
    public int deleteCategoryBrandById(Long id)
    {
        return categoryBrandMapper.deleteCategoryBrandById(id);
    }
}
